from DailyBase import *
from AGDefines import *
import logging

logger = logging.getLogger(__name__)

#通缉悬赏

class ShiLianChang(DailyBase):


    def __init__(self, enum):
        self.RCName = __name__
        self.LogHeader = self.RCName +str(enum.port)
        self.enum = enum
        self.started = False
        self.loadPrivateActions(self.areaDict, ShiLianChangActions)
        logger.info("{} has {} actions".format(self.LogHeader, len(self.areaDict)))

    def KaiShi(self):
        self.begin()

    def process_private(self, img=None, data=None):

        if self.areaDict['JinRuShiLianChang'].detect(img, self.enum) < 10:
            self.enum.click(self.areaDict['JinRuShiLianChang'].click)
        elif self.areaDict['XuanZheDuiShouSL'].detect(img, self.enum) < 10:
            self.enum.click(self.areaDict['XuanZheDuiShouSL'].click, 1000)
        elif self.areaDict['ShiLianCiShu'].detect(img, self.enum) < 10:
            #退出
            self.enum.click(self.areaDict['ShiLianCiShu'].click)
            self.stop()